// 护理管理 / 外出登记

import r from '../../utils/request';
import type { ListParams, ListResponseType, ResponseType } from '../types';


enum API {
    list = '/goOut/list', //外出登记列表
    goOutget = '/goOut/get/',//获取单条外出登记
    delAll = '/goOut/deleteAll',
    del = '/goOut/delete/', //删除外出登记
    add = '/goOut/add', //添加外出登记
    goBackadd = '/goBack/add',//添加外出返回
    update = '/goOut/update',//修改外出登记
}

export interface goOutParams extends ListParams {
    name: string,
    accountId: number,
    state: number,
    beginDate: string,//yyyy-MM-dd
    endDate: string,//yyyy-MM-dd
}
type GetgoOutlistResType = ListResponseType<{
    id: number;
    companyId: number;
    elderlyId: number;
    startTime: string;
    endTime: string;
    mobile: string;
    address: string;
    content: string;
    state: number;
    relation: string;
    name: string;
    addTime: string;
    addAccountId: number;
    addAccountName: string;
    begName: any;
    elderlyName: string;
    elderlyPhoto: string;
    elderlyGender: string;
    elderlyIdCard: string;
    houseName: any;
    buildingName: string;
    stateName: string;
    pictures: any;
    goBack: any;
}>


export interface AdressAddParams {
    name: string;
    qrcode: string;
}

type goOutGetResType = ResponseType<{
    id: number;
    companyId: number;
    elderlyId: number;
    startTime: string;
    endTime: string;
    mobile: string;
    address: string;
    content: string;
    state: number;
    relation: string;
    name: string;
    addTime: string;
    addAccountId: number;
    addAccountName: string;
    begName: any;
    elderlyName: string;
    elderlyPhoto: string;
    elderlyGender: string;
    elderlyIdCard: string;
    houseName: any;
    buildingName: string;
    stateName: string;
    pictures: any;
    goBack: any;
}>

export interface goOutAddParam {
    elderlyId: number;
    elderlyName:string;
    startTime: string;
    endTime: string;
    mobile: string;
    address: string;
    content: string;
    relation: string;
    name: string;
}

type goOutAddResType = ResponseType<{
    id: number;
    companyId: number;
    elderlyId: number;
    startTime: string;
    endTime: string;
    mobile: string;
    address: string;
    content: string;
    state: number;
    relation: string;
    name: string;
    addTime: string;
    addAccountId: number;
    addAccountName: any;
    begName: any;
    elderlyName: any;
    elderlyPhoto: any;
    elderlyGender: any;
    elderlyIdCard: any;
    houseName: any;
    buildingName: any;
    stateName: any;
    pictures: any;
    goBack: any;
}>


export interface goBackAddParam {
    outId:    number;
    backTime: string;
    content:  string;
}

type goBackAddResType = ResponseType<{
    id:             number;
    outId:          number;
    addAccountId:   number;
    addAccountName: any;
    addTime:        string;
    backTime:       string;
    content:        string;
    pictures:       any;
}>

export interface goOutUpdateParams {
    id:number;
    elderlyId: number;
    startTime: string;
    endTime:   string;
    mobile:    string;
    address:   string;
    content:   string;
    relation:  string;
    name:      string;
}
type goOutUpdateResType = ResponseType<{
    id:             number;
    companyId:      number;
    elderlyId:      number;
    startTime:      string;
    endTime:        string;
    mobile:         string;
    address:        string;
    content:        string;
    state:          number;
    relation:       string;
    name:           string;
    addTime:        string;
    addAccountId:   number;
    addAccountName: any;
    begName:        any;
    elderlyName:    any;
    elderlyPhoto:   any;
    elderlyGender:  any;
    elderlyIdCard:  any;
    houseName:      any;
    buildingName:   any;
    stateName:      any;
    pictures:       any;
    goBack:         any;
}>

export function goOutlistAPI(params: goOutParams): Promise<GetgoOutlistResType> {
    return r.get(API.list, params);
}
export function goOutGetAPI(id:number): Promise<goOutGetResType> {
    return r.get(API.goOutget+id);
}

export function DelgoOutAPI(id: number): Promise<ResponseType<null>> {
    return r.delete(API.del + id);
}
export function goOutAddAPI(params: goOutAddParam): Promise<goOutAddResType> {
    return r.post(API.add, params);
}
export function goBackAddAPI(params: goBackAddParam): Promise<goBackAddResType> {
    return r.post(API.goBackadd, params);
}


export function DelAllGooutAPI(id: number[]): Promise<ResponseType<null>> {
    return r.post(API.delAll, id);
}
export function FoodsUpdateAPI(params: goOutUpdateParams): Promise<goOutUpdateResType> {
    return r.put(API.update, params);
}


